﻿using MSSQL.Implement;
using MSSQL.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ApiLogic.BaseLogic
{
    /// <summary>
    /// Dapper依赖注入
    /// </summary>
    public class BaseLogicService
    {

        protected IDataQuery query = new QueryData();

        protected IDataExcute excute = new ExcuteData();

        /// <summary>
        /// 记录操作日志
        /// </summary>
        /// <param name="functionName"></param>
        /// <param name="oprtationType"></param>
        /// <param name="detail"></param>
        protected void WriteLog(int functionName, int oprtationType, string detail, string sKeyValue)
        {
            var userInfo = ClientSession.GetClientInfo();

            //IOperationLog operationLog = UnityDIContainer.DIContainer.GetInjectionInstance<IOperationLog>();
            //operationLog.WriteOperationLog(functionName, oprtationType, userInfo.LoginName, detail, sKeyValue);
        }

        /// <summary>
        /// 记录操作日志
        /// </summary>
        /// <param name="functionName"></param>
        /// <param name="oprtationType"></param>
        /// <param name="detail"></param>
        /// <param name="sKeyValue"></param>
        protected void WriteAsyLog(int functionName, int oprtationType, string detail, string sKeyValue)
        {
            //string ipAddress = WebHelper.GetIP();
            //var userInfo = UserSession.GetLoginUser();
            //Task.Run(() =>
            //{
            //    IOperationLog operationLog = UnityDIContainer.DIContainer.GetInjectionInstance<IOperationLog>();
            //    operationLog.WriteOperationLog(functionName, oprtationType, userInfo.LoginName, ipAddress, detail, sKeyValue);
            //});
        }
    }
}
